<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link href="../css/bootstrap.min.css" rel="stylesheet" />
    <link href="../css/bootstrap-theme.min.css" rel="stylesheet" />
    <link href="../css/logon.css" rel="stylesheet" />
    <link href="../css/header.css" rel="stylesheet" />
    <link rel="stylesheet" href="../css/tailwind.min.css">

    <script src="../js/bootstrap.min.js"></script>
    <script src="../js/jquery-3.4.1.min.js"></script>
    <title>登录</title>
</head>
<body class="body_color">
    <div class="global" id="global">
        <div class="a0"></div>
        <div class="a">
            <div class="a1">
                <div class="a11">
                    <ul class="ax">
                        <li class="a111">
                            <a class="label" title="首页" href="../index.html">首页</a>
                        </li>
                        <li class="a111">
                            <a class="label" title="我的商品" href="../html/login.html">我的商品</a>
                        </li>
                        <li class="a111">
                            <a class="label" title="我有建议" href="">我有建议</a>
                        </li>
                    </ul>
                </div>
                <div class="a11">
                    <div class="row">
                        <div class="col-lg-6 a00">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="Search for...">
                                <span class="input-group-btn">
                            <button class="btn btn-default" type="button">Go!</button>
                          </span>
                            </div><!-- /input-group -->
                        </div><!-- /.col-lg-6 -->
                    </div><!-- /.row -->
                </div>
                <div class="a11" id="rig">
                    <ul class="ax">
                        <li class="a111" id="hove">
                            <!--<a class="label" title="用户名" href="html/login.html" id="user-name-label">用户名</a>-->
                            <a href="../html/login.html">
                                <img src="../img/user_img/0.jpg" class="img-circle" style="margin: 0 auto;">
                            </a>
                            <div class="appear" id="app">
                                <img class="appear-son-gif" src="../img/haipa.gif"/>
                                <div class="appear-son-button">
                                    <a href="../html/login.html" >
                                        <input class="btn btn-default" value="登录" style="width: 240px;"/>
                                    </a>
                                </div>
                                <div class="register-index">还没有账号？
                                    <a title="注册" href="../html/register.html">立即注册</a>
                                </div>
                            </div>
                        </li>
                        <li class="a111">
                            <input class="cursor-pointer h-10 outline-none rounded-full w-10 input-color-picker" type="color" data-id="bg-color" name="Background" style="width: 42px;height: 42px"/>
                        </li>
                        <li class="a111" id="set">
                            <a class="label" title="我有商品" href="../html/add.html">我有商品</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="b">
            <div class="b1"></div>
            <div class="b2">
                <div class="b3">
                    <div class="b4"></div>
                    <div class="b5">
                        <div class="b51">
                            <div class="b55">
                                <div class="b52"></div>

                                <!--用ajax技术判定登录-->
                                <div class="b53">
                                    <input type="text" class="form-control inp" id="inp" placeholder="学号">
                                </div>
                                <div class="b54"></div>
                                <div class="b53">
                                    <input type="password" class="form-control inp" id="in" placeholder="密码">
                                </div>
                                <div class="b54" id="inf" style="color: #ac2925;"></div>
                                <div class="b56">
                                    <input class="btn btn-default log" type="button" value="登录" id="log">
                                </div>
                                <div class="register">还没有账号？
                                    <a title="注册" href="register.html">立即注册</a>
                                </div>

                            </div>
                        </div>
                        <div class="b511"></div>
                        <div class="b51" id="b51">
                            <img src="../img/timg.png" class="img-rounded">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--<div class="rest">-->
        <!--<div class="a" style="text-align: center;">-->
            <!--<span class="cm-button-span">此网站仅供学习无任何商业用途</span>-->
            <!--<span class="cm-button-span">黄山学院软件小组</span>-->
        <!--</div>-->
    <!--</div>-->

    <script src="../js/head_message.js"></script>
</body>
</html>

<script type="text/javascript">
    $("#log").click(function () {
        var name = $("#inp").val();
        var password = $("#in").val();

        if (!name)
        {
            $("#inf").html("用户名不能为空!");
            $("#inp").focus();
            return;
        }
        if (!password)
        {
            $("#inf").html("密码不能为空!");
            $("#in").focus();
            return;
        }



        var par = {"name":name, "password":password};
        $.post("/login", par, function (result) {
            if (result.result === "yes")
            {
                if (typeof (Storage) !== "undefined")
                {
                    //储存
                    var jsons = JSON.stringify(result);
                    // localStorage.setItem("HeadMes", jsons);//localStorage
                    sessionStorage.setItem("head_message", jsons);
                    window.location.href ="../index.html";
                }
            }
            else if (result.result === "en")
            {
                if (typeof (Storage) !== "undefined")
                {
                    //储存
                    var jsons = JSON.stringify(result);
                    // localStorage.setItem("HeadMes", jsons);//localStorage
                    sessionStorage.setItem("admin", jsons);
                    window.location.href ="admin.html";
                }
            }
            else
            {
                $("#inf").html("用户名或密码错误!");
                $("#in").focus();
            }
        })
    });
</script>